import request from '@/utils/request'
//spu
//查
export const reqGetSpuList = (page, limit, category3Id) =>
  request.get(`/admin/product/${page}/${limit}`, { params: { category3Id } })

export const reqAddSpu = skuObj => request.post('/admin/product/saveSpuInfo', skuObj)
// {
//   "category3Id": 0,
//   "description": "string",
//   "id": 0,
//   "spuImageList": [
//     {
//       "id": 0,
//       "imgName": "string",
//       "imgUrl": "string",
//       "spuId": 0
//     }
//   ],
//   "spuName": "string",
//   "spuSaleAttrList": [
//     {
//       "baseSaleAttrId": 0,
//       "id": 0,
//       "saleAttrName": "string",
//       "spuId": 0,
//       "spuSaleAttrValueList": [
//         {
//           "baseSaleAttrId": 0,
//           "id": 0,
//           "isChecked": "string",
//           "saleAttrName": "string",
//           "saleAttrValueName": "string",
//           "spuId": 0
//         }
//       ]
//     }
//   ],
//   "tmId": 0
// }
//修改spu
export const reqUpdateSpu = skuObj => request.post('/admin/product/updateSpuInfo', skuObj)
export const reqDeleteSpu = spuId => request.delete(`/admin/product/deleteSpu/${spuId}`)
//基础销售属性  颜色/版本/尺码
export const reqBaseSaleAttrList = () =>
  request.get(`
/admin/product/baseSaleAttrList`)

// 获取可选品牌列表,添加spu组件中使用
export const reqGetTradeMarkSelect = category3Id =>
  request.get(`/admin/product/baseCategoryTrademark/findCurrentTrademarkList/${category3Id}`)

//根据id获取图片列表
export const reqSpuImageList = spuId => request.get(`/admin/product/spuImageList/${spuId}`)
// 编辑时获取spu基本信息
export const reqSpuInfo = spuId => request.get(`/admin/product/getSpuById/${spuId}`)
//添加sku时获取销售属性
export const respuSaleAttrList = spuId => request.get(`/admin/product/spuSaleAttrList/${spuId}`)

